#ifndef PYCONFIGURATOR_H
#define PYCONFIGURATOR_H

#include <boost/python.hpp>
#include <vector>

enum PyConfError
{
    ERR_UNABLE_TO_LOAD_MODULE = -10000,
    ERR_NO_CONFIG_AVALAIBLE,
    ERR_CONF_INVALID,
    ERR_FONCTION_NOT_EXISTS,
    ERR_FONCTION_DIDNT_RETURN_VALUE,
    ERR_LABEL_DOESNT_EXISTS,
    ERR_CALLING_FUNCTION_FAILED,

    // Last
    ERR_NONE = 0
};

class PyConfigurator
{
private:
    typedef std::vector< std::pair<std::string, boost::python::object> > TVecFunc;

    boost::python::object   m_moduleCfg;

    TVecFunc     m_vecFunctions;
    std::string  m_sTitle;

public:
    /** Default constructor */
    PyConfigurator();

    /** Default destructor */
    virtual ~PyConfigurator();

    int Load(const char* sModuleName = "configurator");
    std::vector<std::string> GetConfigurationLabel() const;
    const std::string& GetTitle() const { return m_sTitle; }
    int Execute(const char* sConf, std::string& sResult);

    void Test();

protected:
private:
    struct PredFindFuncByName
    {
        std::string m_sName;
        PredFindFuncByName(const std::string& sName) : m_sName(sName) { }
        bool operator() (const TVecFunc::value_type& pair) { return pair.first == m_sName; }
    };
};

#endif // PYCONFIGURATOR_H
